package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.manager.mapper.ProductMapper;
import com.atguigu.spzx.manager.mapper.ProductMapperZxw;
import com.atguigu.spzx.manager.service.ProductServiceZxw;
import com.atguigu.spzx.model.dto.product.ProductDto;
import com.atguigu.spzx.model.entity.product.Product;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImplZxw extends ServiceImpl<ProductMapperZxw,Product>  implements ProductServiceZxw {


    @Autowired
    private ProductMapperZxw productMapperZxw;

    //service实现层用于数据处理
    @Override
    public List<Product> findProductAllData() {
        List<Product> productList = productMapperZxw.findProdectAllData();
        return productList;
    }

    @Override
    public PageInfo<Product> findByPage(Integer page, Integer limit, ProductDto productDto) {
        PageHelper.startPage(page, limit);
        List<Product> productList = productMapperZxw.findByPage(productDto);
        PageInfo<Product> pageInfo = new PageInfo<>(productList);
        return pageInfo;
    }

}
